package com.dodo.blog.ui.component.composite;

import com.dodo.blog.ui.component.HtmlComponent;
import com.dodo.blog.ui.component.container.Panel;
import com.dodo.blog.ui.component.simple.Label;

/**
 * @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
 */
public class FormRow
        extends Panel
{
    private static final long serialVersionUID = 1L;

    public FormRow( String text, HtmlComponent component )
    {
        this( text, component, false );
    }

    public FormRow( String text, HtmlComponent component, boolean componentFirst )
    {
        Label label = new Label( text + ( componentFirst ? "" : ":" ), component.getId() );

        if ( componentFirst )
        {
            add( component );
            add( label );
        }
        else
        {
            add( label );
            add( component );
        }

        setClassName( "form-row" );
    }
}
